/**
 * @Author: liutao
 * @Date:   2016-12-22T18:29:12+08:00
 * @Email:  947809647@qq.com
 * @Last modified by:   jbt
 * @Last modified time: 2017-03-22T10:26:39+08:00
 */

import jsCookie from 'js-cookie'

export default function(vm) {
  // 通过 cookie 检查是否有登陆信息，如果无登陆则跳转登陆
  var isLogin = jsCookie.get(SESSION_COOKIE_NAME) === '1'
  if (!isLogin) {
    location.href = client.htmlPath + '/login.html'
    vm.$destroy()
  } else {
    return Promise.resolve()
  }
}
